package com.zx._07_数据库.jdbc;

public class Mate {

    // 分表梳理
    public static int TABLE_NUM = 10;
    // 单表数据量
    public static int TABLE_SIZE = 5 * 1000 * 1000;
    // 数据量总量（所有表之和）
    public static int TABLE_SIZE_SUM = TABLE_SIZE * TABLE_NUM;

    public static String INSERT_SQL = "INSERT INTO t_member_%s (id, real_name, cell_phone, university_name, city, street) VALUES(?, ?, ?, ?, ?, ?)";
    public static String INSERT_SQL_2 = "INSERT INTO t_member_partition (id, real_name, cell_phone, university_name, city, street) VALUES(?, ?, ?, ?, ?, ?)";

    public static int tableIdx(Long id) {
        return (int) (id % Mate.TABLE_NUM);
    }

    public static String getInsertSql(Long id) {
        return String.format(INSERT_SQL, tableIdx(id));
    }

    public static String getInsertSqlPartition() {
        return INSERT_SQL_2;
    }
}
